/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
const path = require('path');
module.exports = appInfo => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    config.security =
        {
            csrf: {
                enable: false,
            },
        };
    config.cors = {
        allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
        origin: '*',
    };

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1681545102297_9233';
   // const appPort = 21885;
       const appPort = 10086;
    // add your middleware config here
    config.middleware = [];
    config.cluster = {
        listen: {
            path: '',
            port: appPort,
            hostname: '0.0.0.0',
        },
    };
// config/config.default.js
    exports.keys = '197812060011logs'; // 确保这个值是唯一的，且保密

    config.static = {
        prefix: '/',
        dir: path.join(appInfo.baseDir, './public'),
        dynamic: true, // 是否緩存靜態資源
        preload: false, // 啓動項目開啓緩存
        // maxAge: 31536000,
        maxAge: 0, // 緩存時間
        buffer: true, // 是否緩存到内存 默認prod 緩存
    };
    config.dataBusMaxListeners = 10000;
    config.devMqtt = {
        enable: true,
        // url: 'tcp://www.treec.cn',
        // url: 'tcp://www.iotmqtt.cn',
        // port: 21883,
        url: 'tcp://60.173.17.240',
        port: 10049,
    },
        exports.validate = {
            // convert: false,
            // validateRoot: false,
        };
    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };

    return {
        ...config,
        ...userConfig,
    };
};
